package com.css.zfzx.sjcj.modules.hddcDrillProfile.repository;

import com.css.zfzx.sjcj.modules.hddcDrillProfile.repository.entity.HddcDrillprofileEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author zyb
 * @date 2020-11-30
 */
public interface HddcDrillprofileRepository extends JpaRepository<HddcDrillprofileEntity, String> {
    @Query(nativeQuery = true,value="select w.* from hddc_drillprofile  w where w.id=?1 and w.is_valid=1")
    HddcDrillprofileEntity findbyId(String id);

    @Modifying
    @Query(nativeQuery = true,value = "update hddc_drillprofile set qualityinspection_status=:qualityinspection_status ,extends1=:extend1 where projectid=:workregionid")
    void updateStatus(@Param("qualityinspection_status") String qualityinspection_status,@Param("extend1")  String extend1,@Param("workregionid") String workregionid);

    @Query(nativeQuery = true,value = "select * from hddc_drillprofile where is_valid=1 and extends10=1")
    List<HddcDrillprofileEntity> findByAll();

    HddcDrillprofileEntity findByUuidAndIsValid(String id, String isValid);
}
